package pub.pjoc.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author xiongyingqi
 * @since 16-9-21 下午8:37
 */
public abstract class StringUtils {
  private static final Logger logger = LoggerFactory.getLogger(StringUtils.class);

  public static String fillZero(String string, int maxWidth) {
    int least = maxWidth - string.length();
    if (least > 0) {
      StringBuilder builder = new StringBuilder(string);
      for (int i = 0; i < least; i++) {
        builder.insert(0, '0');
      }
      return builder.toString();
    }
    return string;
  }

}
